package com.fifth.commodity.controller.api;

import com.fifth.common.pojo.dto.CommonResult;
import com.fifth.common.pojo.entity.Brand;
import com.fifth.commodity.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/brand")
public class ApiBrandController {
    @Autowired
    private BrandService brandService;

    /*
    *
    *
    * 查询所有
    */
    @PostMapping("selectall")
    public CommonResult Selectall(@RequestBody Brand brand){
        CommonResult commonResult = brandService.selectAll(brand);
            return new CommonResult(2000,"查询成功",commonResult);
    }

    /*
    *
    * 添加
    * */

    @PostMapping("insert")
    public CommonResult Insert(@RequestBody Brand brand){

       return brandService.insertBrand(brand);
    }


    /*
    *
    * 修改
    * */

    @PostMapping("updateById")
    public CommonResult updateById(@RequestBody Brand brand){
        return new CommonResult(2000,"修改成功",brandService.updateById(brand));
    }
}
